#include <stdio.h>
#define MAX_SIZE 5

void sort_vec(int[], int*, int*);

int main()
{
    int vec[MAX_SIZE] = {0}, i = 0, vec_max = 0, vec_min = 0;
    
    printf("Input %d elements for sorting: ", MAX_SIZE);
    for (i = 0; i < MAX_SIZE; i++)
        scanf(" %d", &vec[i]);

    sort_vec(vec, &vec_max, &vec_min);
    printf("The max is %d, the min is %d", vec_max, vec_min);

    return 0;
}

void sort_vec(int a[], int* max, int* min)
{
    *max = a[0], *min = a[0];
    for (int i = 1; i < 5; i++) {
        if (a[i] < *min)
            *min = a[i];
        if (a[i] > *max)
            *max = a[i];
    }
}